﻿using System;
using System.Data;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Reflection;
using AnyOffice.BIZ;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;

namespace AnyOffice.general.notify.manage
{
    public partial class read_notify : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int notifyId = (Request.QueryString["notify_id"] == null) ? 0 : int.Parse(Request.QueryString["notify_id"].ToString());
            DataTable table = new NotifyDao().SelectByNotifyId(base.Conn, notifyId, base.User.Identity.Name);
            if (table.Rows.Count == 0)
            {
                this.pnlMain.Visible = false;
                this.litMessage.Text = base.ShowPromptClose("无公告通知");
            }
            else
            {
                this.litSubject.Text = table.Rows[0]["Subject"].ToString();
                this.litTypeName.Text = table.Rows[0]["TypeName"].ToString();
                this.litUserName.Text = "<u title=\"部门：" + table.Rows[0]["DeptName"].ToString() + "\" style=\"CURSOR:hand\">" + table.Rows[0]["UserName"].ToString() + "</u>";
                this.litSendTime.Text = (table.Rows[0]["SendTime"] != DBNull.Value) ? table.Rows[0]["SendTime"].ToString() : "";
                this.litContent.Text = (table.Rows[0]["Content"] != DBNull.Value) ? table.Rows[0]["Content"].ToString() : "";
                if (table.Rows[0]["AttachmentId"] != DBNull.Value)
                {
                    string attachmentId = table.Rows[0]["AttachmentId"].ToString();
                    if ((this.litAttachment.Text = AttachmentBiz.Display(base.Conn, attachmentId)) != string.Empty)
                    {
                        this.pnlAttachment.Visible = true;
                    }
                    else
                    {
                        this.litAttachment.Text = "无";
                    }
                }
            }
        } 

    }
}
